[6.x] Exclude private ($__) variables from cache context to resolve serialization exception - #15130
Merged
jasonvarga merged 4 commits intoAug 7, 2026
Conversation
Contributor
Author
|
Similar, but not identical to #6839 |
jasonvarga
enabled auto-merge (squash)
August 6, 2026 15:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
@blazein a Blade-based Statamic site, using thenocachetag or directive would result in an exception:Within the NoCache Region
filterContextmethod, explicit context properties were removed, plus__env.Blaze adds a
__blazewhich includes a closure - this is what is causing the exception to be thrown.This PR keeps the same rejection, but instead of just
__env, excludes any private variables (i.e. those prefixed with__).If this feels too heavy-handed, another approach would be to revert to what it was, but add
__blazeto the list too.However, the challenge with this approach is that if future updates introduce new private variables with the same closure behaviour, the issue will re-occur.
So while the "exclude any private variable" is very wide, it also covers other internals being excluded (i.e. if things within Blaze, Blade, Livewire, etc, evolve).